package com.xseagull.scm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xseagull.scm.common.ResultData;
import com.xseagull.scm.entity.User;
import com.xseagull.scm.service.IUserService;

@RestController
@RequestMapping("/user")
public class UserController {
	@Autowired
	private IUserService userService;
	
	/**
	 * 新增用户信息
	 */
	@PostMapping("/insert")
	public ResultData insert(User user) {
		return userService.insert(user);
	}

	/**
	 * 更新用户信息
	 */
	@PostMapping("/update")
	public ResultData update(User user) {
		return userService.update(user);
	}
	
	@GetMapping("/getOneParameter")
    public ResultData getOneParameter(int number){
		return userService.getOneParameter(number);
	}
	
	@GetMapping("/getMoreParameter")
    public ResultData getMoreParameter(int number, String name){
		return userService.getMoreParameter(number, name);
	}
	
	@GetMapping("/getPathVariable/{number}")
    public ResultData getPathVariable(@PathVariable int number){
		return userService.getPathVariable(number);
	}
	
	@PostMapping("/postOneParameter")
    public ResultData postOneParameter(int number){
		return userService.postOneParameter(number);
	}
	
	@PostMapping("/postMoreParameter")
    public ResultData postMoreParameter(int number, String name){
		return userService.postMoreParameter(number, name);
	}
	
	@PostMapping("/postPathVariable/{number}")
    public ResultData postPathVariable(@PathVariable int number){
		return userService.postPathVariable(number);
	}
	
	@PostMapping("/postObject")
    public ResultData postObject(User user){
		return userService.postObject(user);
	}
}
